package com.designPattern.foctory.absFactory.factory.factoryBuilder;

import com.designPattern.foctory.absFactory.factory.AbsInstanceFactory;
import com.designPattern.foctory.absFactory.instance.Instance;

/**
 * @author mxs
 */
public class InstanceFactoryBuilder {
    AbsInstanceFactory factory;

    /**
     * 创建一个构造方法可以传入工厂
     * @param factory
     */
    public InstanceFactoryBuilder(AbsInstanceFactory factory) {
        this.factory = factory;
    }

    /**
     * 获取实例
     * @param instanceType
     * @return
     */
    public Instance getInstance(String instanceType){
        return factory.createInstance(instanceType);
    }

}
